home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / gnu / glibc108.zip / glibc108 / Rules < prev    next >
Text File  |  1994-05-03  |  4KB  |  125 lines

  1. # Copyright (C) 1991, 1992, 1993, 1994 Free Software Foundation, Inc.
  2. # This file is part of the GNU C Library.
  3.  
  4. # The GNU C Library is free software; you can redistribute it and/or
  5. # modify it under the terms of the GNU Library General Public License as
  6. # published by the Free Software Foundation; either version 2 of the
  7. # License, or (at your option) any later version.
  8.  
  9. # The GNU C Library is distributed in the hope that it will be useful,
  10. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  12. # Library General Public License for more details.
  13.  
  14. # You should have received a copy of the GNU Library General Public
  15. # License along with the GNU C Library; see the file COPYING.LIB.  If
  16. # not, write to the Free Software Foundation, Inc., 675 Mass Ave,
  17. # Cambridge, MA 02139, USA.
  18.  
  19. #
  20. #    Rules for making a subdirectory in the GNU C library.
  21. #    Each subdirectory Makefile defines some variables and includes this.
  22. #
  23. ifneq (,)
  24. This makefile requires GNU Make.
  25. endif
  26.  
  27. all: # Don't let the default goal come from Makeconfig.
  28.  
  29. include ../Makeconfig
  30.  
  31. ifndef    subdir
  32. Each subdirectory makefile must define the `subdir' variable.
  33. endif
  34. # This is benign and useless in GNU make before 3.63.
  35. export subdir := $(subdir)
  36.  
  37. # This is the default target; it makes the library and auxiliary programs.
  38. .PHONY: all
  39. all: lib others
  40.  
  41. ifneq    "$(findstring env,$(origin headers))" ""
  42. headers :=
  43. endif
  44.  
  45. ifneq    "$(findstring env,$(origin generated))" ""
  46. generated :=
  47. endif
  48.  
  49. ifeq "$(strip $(headers))" ""
  50. ifneq "$(wildcard $(subdir).h)" ""
  51. override headers := $(subdir).h
  52. endif
  53. endif
  54.  
  55. include ../Makerules
  56.  
  57. .PHONY: subdir_lib
  58. subdir_lib: lib-noranlib
  59.  
  60. # Some subdirs need to install a dummy library.
  61. # They can use "$(objpfx)libfnord.a: $(dep-dummy-lib); $(make-dummy-lib)".
  62. dep-dummy-lib = $(objpfx)dummy.o
  63. define make-dummy-lib
  64. $(AR) cr$(verbose) $@ $<
  65. endef
  66. $(objpfx)dummy.o:
  67.     @rm -f $(@:.o=.c)
  68.     cp /dev/null $(@:.o=.c)
  69.     $(CC) -c $(@:.o=.c) -o $@
  70.  
  71. # This makes all the auxilliary and test programs.
  72.  
  73. .PHONY: others tests
  74. others: $(addprefix $(objpfx),$(others))
  75. tests: $(tests:%=$(objpfx)%.out)
  76.  
  77. ifneq "$(strip $(others) $(tests))" ""
  78. $(addprefix $(objpfx),$(others) $(tests)): %: %.o $(libc.a)
  79.     $(+link)
  80. endif
  81.  
  82. ifneq "$(strip $(tests))" ""
  83. # These are the implicit rules for making test outputs
  84. # from the test programs and whatever input files are present.
  85. $(objpfx)%.out: $(objpfx)% %.args %.input
  86.     $(dir $<)$(notdir $<) `cat $(word 2,$^)` < $(word 3,$^) > $@
  87. $(objpfx)%.out: $(objpfx)% %.args
  88.     $(dir $<)$(notdir $<) `cat $(word 2,$^)` > $@
  89. $(objpfx)%.out: $(objpfx)% %.input
  90.     $(dir $<)$(notdir $<) < $(word 2,$^) > $@
  91. $(objpfx)%.out: $(objpfx)%
  92.     $(dir $<)$(notdir $<) > $@
  93. endif    # tests
  94.  
  95. .PHONY: distclean realclean subdir_distclean subdir_realclean \
  96.     subdir_clean subdir_mostlyclean
  97. subdir_mostlyclean: mostlyclean
  98. subdir_clean: clean
  99. subdir_distclean: distclean
  100. subdir_realclean: realclean
  101. realclean: distclean
  102. distclean: clean
  103.  
  104. .PHONY: subdir_echo-headers
  105. subdir_echo-headers: echo-headers
  106.  
  107. .PHONY: subdir_echo-distinfo
  108. subdir_echo-distinfo:
  109.     @echo $(addprefix +header+,$(headers)) \
  110.           $(addprefix +nodist+,$(generated) $(dont_distribute))
  111.  
  112. # We want to install everything except the library itself, but update all
  113. # our portions of the library because the parent make will install it later
  114. # (likewise the stubs file).
  115. .PHONY: subdir_install
  116. subdir_install: install-no-libc.a lib-noranlib stubs
  117.  
  118. .PHONY: subdir_TAGS subdir_dist
  119. subdir_TAGS: TAGS
  120. subdir_dist: dist
  121.  
  122. # Convenient target to update all the generated source files.
  123. .PHONY: generated
  124. generated: $(addprefix $(objpfx),$(generated))
  125.